import md5 from 'js-md5';
// 解析url参数并获取code
function getQueryValue(queryName) {
    var query = decodeURI(window.location.search.substring(1));
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == queryName) { return pair[1]; }
    }
    return null;
}

// 验签
function getAttestation() {
    var d = new Date(),str = 'SECURITY'
    console.log(str+"-"+d.getFullYear() + "-" +(d.getMonth() + 1) + "-" + d.getDate())
    var date =md5(str+"-"+d.getFullYear() + "-" +(d.getMonth() + 1) + "-" + d.getDate());
    return date
}


export { getQueryValue, getAttestation }